import { request } from "@/utils/service"
import type * as adminLog from "./types/adminLog"
import type * as Open from "./types/Open"
import type * as Company from "./types/company"
import type * as dictionary from "./types/dictionary"
import type * as dictType from "./types/dictType"
import type * as dictData from "./types/dictData"

/** 查 */
export function getAdminLogListApi(params: adminLog.GetTableData) {
  return request<adminLog.GetTableResponseData>({
    url: "adminLog/adminLogList",
    method: "get",
    params
  })
}

export function getOpenListApi(params: Open.GetTableRequestData) {
  return request<Open.GetTableResponseData>({
    url: "/open/openList",
    method: "get",
    params
  })
}

export function createOpenApi(data: Open.createRequestData) {
  return request({
    url: "/open/openAdd",
    method: "post",
    data
  })
}

// 导出一个函数，用于创建公司添加API
export function createCompanyAddApi(data: Company.createRequestData) {
  // 发送请求，请求地址为/Company/create，请求方法为post，请求参数为data
  return request({
    url: "/Company/create",
    method: "post",
    data
  })
}

// 导出一个函数，用于获取公司列表
export function getCompanyListApi(params: Company.GetTableData) {
  // 发送请求，获取公司列表数据
  return request<Company.GetTableResponseData>({
    // 请求的URL
    url: "/Company/list",
    // 请求的方法
    method: "get",
    // 请求的参数
    params
  })
}

export function getCompanyDetailApi(params: Company.GetDetailRequestData) {
  return request<Company.GetDetailResponseData>({
    url: "/Company/detail",
    method: "get",
    params
  })
}

export function editCompanyApi(data: Company.updateRequestData) {
  return request({
    url: "/Company/edit",
    method: "put",
    data
  })
}

export function deleteCompanyApi(data: Company.deleteDetailRequestData) {
  return request({
    url: `/Company/delete`,
    method: "delete",
    data
  })
}

export function companyListApi(params: Company.companyListRequestData) {
  return request<any>({
    url: `/Company/companyList`,
    method: "get",
    params
  })
}
export function companyQuickListApi(params: any) {
  return request<any>({
    url: `/Company/quickList`,
    method: "get",
    params
  })
}
// 客户数量
export function companycountClientApi(params: any) {
  return request<any>({
    url: `/Company/countClient`,
    method: "get",
    params
  })
}
// 客户数量
export function companygetUndeliveredClientApi(params: any) {
  return request<any>({
    url: `/Company/getUndeliveredClient`,
    method: "get",
    params
  })
}
// 客户导出
export function companydoExportApi(params: any) {
  return request<any>({
    url: `/Company/doExport`,
    method: "get",
    params
  })
}
// 获取指定公司在某月的每日交易记录数量和总金额
export function companyMonthlyTradeDataApi(params: any) {
  return request<any>({
    url: `/Company/getCountMoney`,
    method: "get",
    params
  })
}

export function dictionaryListApi(params: dictionary.GetListData) {
  return request<any>({
    url: `/Dictionary/getList`,
    method: "get",
    params
  })
}
export function createDictionaryAddApi(data: dictionary.createRequestData) {
  return request({
    url: "/Dictionary/create",
    method: "post",
    data
  })
}

export function editDictionaryApi(data: dictionary.updateRequestData) {
  return request({
    url: "/Dictionary/update",
    method: "put",
    data
  })
}
export function deleteDictionaryApi(data: dictionary.deleteRequestData) {
  return request({
    url: `/Dictionary/delete`,
    method: "delete",
    data
  })
}

// 字典类型
export function dictTypeListApi(params: dictType.GetTableData) {
  return request<any>({
    url: `/DictType/list`,
    method: "get",
    params
  })
}
export function dictTypeAddApi(data: dictType.addRequestData) {
  return request({
    url: "/DictType/add",
    method: "post",
    data
  })
}

export function dictTypeEditApi(data: dictType.editRequestData) {
  return request({
    url: "/DictType/update",
    method: "put",
    data
  })
}
export function dictTypeDeleteApi(data: dictType.deleteRequestData) {
  return request({
    url: `/DictType/delete`,
    method: "delete",
    data
  })
}

// 字典类型
export function dictDataListApi(params: dictData.GetTableData) {
  return request<any>({
    url: `/DictData/list`,
    method: "get",
    params
  })
}
export function dictDataGetListApi(params: dictData.GetTableListData) {
  return request<any>({
    url: `/DictData/getList`,
    method: "get",
    params
  })
}
export function dictDataAddApi(data: dictData.addRequestData) {
  return request({
    url: "/DictData/add",
    method: "post",
    data
  })
}

export function dictDataEditApi(data: dictData.editRequestData) {
  return request({
    url: "/DictData/edit",
    method: "put",
    data
  })
}
export function dictDataDeleteApi(data: dictData.deleteRequestData) {
  return request({
    url: `/DictData/delete`,
    method: "delete",
    data
  })
}
